package com.ag.zlw.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbEventType;
import com.ag.common.AgException;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.zlw.dao.TbEventTypeDAO;
import com.ag.zlw.service.EventTypeService;

/**
 * 事件类型
 * 
 * @author 钟龙伟
 * 
 */

@Service("EventTypeService")
public class EventTypeServiceImpl implements EventTypeService {
	@Resource(name = "ZLWTbEventTypeDAO")
	private TbEventTypeDAO tbEventTypeDAO;

	private String IDs;
	@Resource(name = "iDServiceImpl")
	private IIDService idservice;

	public void save(TbEventType etEventType) throws AgException {
		IDs = (String) idservice.findTablePK(IDUtil.TB_EVENT_TYPE);
		etEventType.setEtId(IDs);
		tbEventTypeDAO.save(etEventType);
	}

	public void delete(TbEventType etEventType) {
		TbEventType tbEventType = tbEventTypeDAO
				.findById(etEventType.getEtId());
		tbEventType.setA(IDUtil.DELETE);
		tbEventTypeDAO.attachDirty(tbEventType);
	}

	public List<TbEventType> findAll() {
		return tbEventTypeDAO.findAll();
	}

	public void modify(TbEventType etEventType) {
		tbEventTypeDAO.attachDirty(etEventType);
	}
}
